﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SubirInformacion
{
    public partial class Procesando : Form
    {
        BackgroundWorker worker;
        DateTime fechaInicio;
        DateTime fechaFin;
        public Procesando()
        {
            InitializeComponent();
        }

        private void Procesando_Load(object sender, EventArgs e)
        {
            worker = new BackgroundWorker();
            worker.DoWork += new DoWorkEventHandler(worker_DoWork);
            worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);

            worker.RunWorkerAsync();
        }

        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            fechaInicio = DateTime.Now;
            Procesar procesar = new Procesar();
            procesar.ProcesarInformacion();

        }

        private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {

            MessageBox.Show("Información Procesada correctamente, Inicio: " + fechaInicio.ToShortTimeString() + " Finalización: " + DateTime.Now.ToShortTimeString());
            this.Close();
        }
    }
}
